package oss

import (
	"gitee.com/alex_li/zangjingge/internal/etc"
	"path"
)

type TempFileMeta struct {
	Md5       string `json:"md5"`
	Sha256    string `json:"sha256"`
	Id        string `json:"id"`
	Ext       string `json:"ext"`
	FileName  string `json:"fileName"`
	FileSize  int64  `json:"fileSize"`
	Timestamp int64  `json:"timestamp"`
}

func GetRootFolder() (root string) {
	root = etc.Config.Storage.Bucket
	if len(root) == 0 {
		root = "./test_uploads"
	}
	return
}

func GetTempRootFolder() (root string) {
	root = etc.Config.Storage.Upload
	if len(root) == 0 {
		root = "./test_temp_upload"
	}
	return
}

func GetAbsPath(bucket string, relPath string) string {
	p := path.Join(GetRootFolder(), bucket, relPath)
	return p
}

func GetMetaFilePath(folder string) string {
	return path.Join(folder, "meta.json")
}
